<?php
declare (strict_types = 1);

namespace app\common\model;

use think\Model;
use think\response\Json;

/**
 * @mixin \think\Model
 */
class CheckList extends Base
{

    protected $name = 'check_list';

    public function pro()
    {
        return $this->hasOne(Pro::class, 'id', 'pro_id')->field('id,title');
    }
    public function oneuser()
    {
        return $this->hasOne(User::class, 'id', 'one_uid')->field('id,nickname');
    }
    public function twouser()
    {
        return $this->hasOne(User::class, 'id', 'two_uid')->field('id,nickname');
    }
    public function threeuser()
    {
        return $this->hasOne(User::class, 'id', 'three_uid')->field('id,nickname');
    }

    public function getOneTimeAttr($value)
    {
        return $value ? date('Y-m-d H:i:s', $value) : '';
    }


    public function getTwoTimeAttr($value)
    {
        return $value ? date('Y-m-d H:i:s', $value) : '';
    }


    public function getThreeTimeAttr($value)
    {
        return $value ? date('Y-m-d H:i:s', $value) : '';
    }


    public function company()
    {
        return $this->hasOne(Company::class, 'id', 'company_id')->field('id,company_name as title');
    }

}
